<%@ page language="java" import="java.util.*,cn.ac.cintcm.dataconverge.util.Constants,com.hs.core.utils.*" pageEncoding="UTF-8"%>
<%@ page import ="cn.ac.cintcm.dataconverge.researchsubject.domain.*" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
Subject obj = (Subject)request.getAttribute("subjectObj");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title><%=Constants.APP_TITLE %></title>  
<script language="javascript" type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
<script language="javascript" src="<%=path %>/index/Scripts/script.js"></script>
<script language="javascript" src="<%=path %>/js/common.js"></script>
<link href="<%=path %>/index/Themes/com/style.css" type="text/css" rel="stylesheet"></link>
<script src='<%=basePath%>dwr/util.js'></script> 
<script type="text/javaScript">
/**
 获得分类树所有分类
*/
function getTagValues(){		
			var parentNode=document.getElementById("tagIdPlace");
			var docu=document.frames("tagTreeFrame").document;
			var tagIds = "";
			var input; 
			if(null != docu.all.tags)
			for(i=0;i<docu.all.tags.length;i++){
				var obj = docu.all.tags[i];  
				if(obj.checked==true){  
				    tagIds += obj.value+",";
				}					
			}
			parentNode.value = tagIds;
}
function saveData(){
    if(checkForm()){
         getTagValues();
    	 form2.submit();
    }
}
function checkForm(){
			var fo=document.form2;
			var exp = new RegExp("^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$");
			if(isNull(fo.projectname.value)){
				alert("请填写项目名称");
				fo.projectname.focus();
				return false;
			}
			if(isNull(fo.projectorg.value)){
				alert("请选择项目组织单位");
				fo.projectorg.focus();
				return false;
			}
			if(isNull(fo.subjectname.value)){
				alert("请填写课题名称");
				fo.subjectname.focus();
				return false;
			}
			if(isNull(fo.theme.value)){
				alert("请填写主题词");
				fo.theme.focus();
				return false;
			}
			if(isNull(fo.applydate.value)){
				alert("请选择申请时间");
				fo.applydate.focus();
				return false;
			}
			if(isNull(fo.applyfund.value)){
				alert("请填写申请经费"); 
				fo.applyfund.focus();
				return false;
			}
			if(!isDigital(fo.applyfund.value)){
				alert("申请经费填写有误");
				return false;
			}
			if(isNull(fo.belongyear.value)){
				alert("请填写课题所属年份");
				fo.belongyear.focus();
				return false;
			}
			if(isNull(fo.startdate.value)){
				alert("请填写课题计划开始时间");
				fo.startdate.focus();
				return false;
			}
			if(isNull(fo.enddate.value)){
				alert("请填写课题计划结束时间");
				fo.enddate.focus();
				return false;
			}
			if(isNull(fo.abstractContent.value)){
				alert("请填写课题概述");
				fo.abstractContent.focus();
				return false;
			} 
			return true;
		}
</script>
</head>
<body class="idt_body" scroll="yes">
<form name="form2" action="<%=path %>/subjectToAdd.htm?action=onSubmit" method="post">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" id="Table5">
        <tr>
            <td class="idt_top_l">
            </td>
            <td class="idt_top_m">
                <!------------------ 标题栏 ------------------>
                <table width="100%" cellpadding="0" cellspacing="0" class="idt_hdr_mg" id="Table10"
                    border="0"> 
                    <tr>
                        <td class="idt_hdr_l">
                        	<input type="hidden" name="tagIdPlace" id="tagIdPlace" value=""/>
                        	<input type="hidden" name="id" id="tagIdPlace" value="<%=obj==null?"":obj.getId() %>"/>
                        </td>
                        <td>
                            <table border="0" cellpadding="0" cellspacing="0" class="idt_hdr_f" style="width: 100%;
                                text-align: center">
                                <tr>
                                    <td>
                                        课题申报</td>
                                </tr>
                            </table>
                        </td>
                        <td class="idt_hdr_td_r">
                        </td>
                        <td class="idt_hdr_r" style="width: 75%;">
                            <!------------------ 工具栏 ------------------>
                            <div style="text-align: right">
                                <table class="idt_tb_mg" id="Table3" cellspacing="0" cellpadding="0" width="*" border="0">
                                    <tr class="idt_tb_m">
                                        <td class="idt_tb_i">
                                            <img src="<%=basePath %>index/themes/com/idt_tb_close.gif"></td>
                                        <td class="idt_tb_f">
                                            <a href="javascript:window.close();">&nbsp;关闭&nbsp;</a></td>
                                    </tr>
                                </table>
                            </div> 
                        </td>
                    </tr>
                </table>
                <!-----------------END- 标题栏 ------------------>
            </td>
            <td class="idt_top_r">
            </td>
        </tr>
    </table>
    <table cellpadding="0" cellspacing="0" width="100%" height="100%" id="Table8">
        <tr>
            <td height="100%" style="padding-top: 3px;">
                <div id="navDiv10">
                    <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" id="Table11">
                        <tr>
                        	<td width="30%" height="100%" valign="top">
                        		<iframe width="100%"   name="tagTreeFrame" onload="this.height=tagTreeFrame.document.body.scrollHeight+10"  frameborder="0" src="<%=path %>/tagTree.htm?oper=add"></iframe>
                        	</td>
                            <td class="idt_main_m" valign="top"> 
                                <!--- 标题 ---->
                                <table class="idt_tle_mg" cellspacing="0" cellpadding="0" width="100%">
                                    <tr onclick="javascript:OnShow(tdForm,imgForm6);">
                                        <td class="idt_tle_i">
                                            <img id="imgForm6" src="/tdm/index/Themes/com/idt_tle_o.gif"></td>
                                        <td class="idt_tle_f1">
                                           基本信息</td>
                                    </tr>
                                </table>
                                <!--- 内容 --->
                                <div id="tdForm"> 
                                    <table border="0" cellpadding="0" cellspacing="1" width="100%"  class="dg_borderstyle">
                                       <tr>
                                            <td class="fim_l" width="10%">项目名称</td>
                                            <td class="fim_r"   >
                                            <input type="text" name="projectname" value="<%=obj==null?"":StringUtilTool.NULL2Blank(obj.getProjectname()) %>" class="com_textbox" style="width:99%"/></td> 
                                            <td class="fim_l" width="10%">项目组织单位</td>
                                            <td class="fim_r"   >
                                            <input type="text" name="projectorg" value="<%=obj==null?"":StringUtilTool.NULL2Blank(obj.getProjectorg()) %>" class="com_textbox" style="width:99%"/></td> 
                                        </tr> 
                                        <tr>
                                            <td class="fim_l" width="10%">课题名称</td>
                                            <td class="fim_r"  colspan="3">
                                            <input type="text" name="subjectname" value="<%=obj==null?"":StringUtilTool.NULL2Blank(obj.getSubjectname()) %>" class="com_textbox" style="width:100%"/></td> 
                                        </tr> 
                                        <tr>
                                            <td class="fim_l" width="10%">课题英文名称</td>
                                            <td class="fim_r"   colspan="3">
                                            <input type="text" name="subjectnameEn" value="<%=obj==null?"":StringUtilTool.NULL2Blank(obj.getSubjectnameEn()) %>" class="com_textbox" style="width:100%"/></td> 
                                        </tr>  
                                        <tr>
                                            <td class="fim_l" width="10%">主题词</td>
                                            <td class="fim_r"  colspan="3">
                                            <input type="text" name="theme" value="<%=obj==null?"":StringUtilTool.NULL2Blank(obj.getTheme()) %>" class="com_textbox" style="width:100%"/></td> 
                                        </tr>  
                                        <!--  <tr>
                                            <td class="fim_l" width="10%">课题来源</td>
                                            <td class="fim_r"  colspan="3">
                                            <input type="text" name="comefrom" class="com_textbox" style="width:100%"/></td> 
                                        </tr> 
                                        <tr>
                                            <td class="fim_l" width="10%">申报学科</td>
                                            <td class="fim_r"  colspan="3">
                                            <input type="text" name="studySubject" class="com_textbox" style="width:100%"/></td> 
                                        </tr> 
                                        <tr>
                                            <td class="fim_l" width="10%">研究方向</td>
                                            <td class="fim_r"  colspan="3">
                                            <input type="text" name="researchDirect" class="com_textbox" style="width:100%"/></td> 
                                        </tr> 
                                        <tr>
                                            <td class="fim_l" width="10%">研究属性</td>
                                            <td class="fim_r"  colspan="3">
                                            <input type="text" name="reserachProp" class="com_textbox" style="width:100%"/></td> 
                                        </tr> -->
                                        <tr>
                                            <td class="fim_l" width="10%">申请时间</td>
                                            <td class="fim_r"  > 
                                           <input type="text" class="Wdate" id="applydate" value="<%=obj==null?Tools.getDateStr():Tools.getYmdStr(obj.getApplydate()+"") %>" style="width:99%" name="applydate"  onFocus="WdatePicker({el:'applydate',dateFmt:'yyyy-MM-dd'})" />
                                            </td> 
                                             <td class="fim_l" width="10%">中标时间</td>
                                            <td class="fim_r"  >
                                             <input type="text" class="Wdate" id="permitdate" value="<%=obj==null?"":Tools.getYmdStr(obj.getPermitdate()+"") %>" style="width:99%" name="permitdate"  onFocus="WdatePicker({el:'permitdate',dateFmt:'yyyy-MM-dd'})" /></td> 
                                        </tr> 
                                        <tr> 
                                             <td class="fim_l" width="10%">申请经费</td>
                                            <td class="fim_r"  >
                                            <input type="text" name="applyfund" class="com_textbox" value="<%=obj==null?"":StringUtilTool.setObjNULLStr(obj.getApplyfund()) %>" style="width:99%"/></td> 
                                            <td class="fim_l" width="10%">中标经费</td>
                                            <td class="fim_r"  > 
                                            <input type="text" name="permitfund" value="<%=obj==null?"":StringUtilTool.setObjNULLStr(obj.getPermitfund()) %>" class="com_textbox" style="width:99%"/></td> 
                                        </tr> 
                                        <tr> 
                                             <td class="fim_l" width="10%">实获经费</td>
                                            <td class="fim_r"  >
                                            <input type="text" name="actualfund" class="com_textbox" value="<%=obj==null?"":StringUtilTool.setObjNULLStr(obj.getActualfund()) %>" style="width:99%"/></td> 
                                            <td class="fim_l" width="10%">课题所属年份</td>
                                            <td class="fim_r"  >
                                            <input type="text" name="belongyear" value="<%=obj==null?Tools.getYear():StringUtilTool.NULL2Blank(obj.getBelongyear()) %>" class="com_textbox" style="width:99%"/></td>  
                                        </tr> 
                                        <tr>
                                            <td class="fim_l" width="10%">计划开始时间</td>
                                            <td class="fim_r"  >
                                            <input type="text" class="Wdate" id="startdate" value="<%=obj==null?Tools.getDateStr():Tools.getYmdStr(obj.getStartdate()+"") %>" style="width:99%" name="startdate"  onFocus="WdatePicker({el:'startdate',dateFmt:'yyyy-MM-dd'})" />
                                             </td> 
                                             <td class="fim_l" width="10%">计划结束时间</td>
                                            <td class="fim_r"  >
                                            <input type="text" class="Wdate" id="enddate" value="<%=obj==null?Tools.getDateStr():Tools.getYmdStr(obj.getEnddate()+"") %>"" style="width:99%" name="enddate" style="width:200px" onFocus="WdatePicker({el:'enddate',dateFmt:'yyyy-MM-dd'})" />
                                             </td> 
                                        </tr> 
                                        <tr>
                                            <td class="fim_l" width="10%">课题概述</td>
                                            <td class="fim_r"  colspan=3>
                                            <textarea rows="6" name="abstractContent" style="width:100%;overflow-x :visible;overflow-y:visible;" ><%=obj==null?"":StringUtilTool.NULL2Blank(obj.getAbstractContent()) %></textarea>
                                            </td>  
                                        </tr> 
                                        <tr>
                                            <td class="fim_l" width="10%">课题正文</td>
                                            <td class="fim_r"  colspan=3>
                                            <textarea rows="10" name="content" style="width:100%;overflow-x :visible;overflow-y:visible;" ><%=obj==null?"":StringUtilTool.NULL2Blank(obj.getContent()) %></textarea>
                                            </td>  
                                        </tr>  
                                    </table>
                                    <table cellspacing="0" cellpadding="0" width="100%" class="idt_bottom_mg" border="0">
                                      <tr>
                                        <td align="right"><input type="button" value="保存"   class="com_btn2"   onclick="saveData()" />
                                            <input type="button" value="关闭" name="B4" class="com_btn2" id="Button2" onclick="javascript:window.close();" />
                                        </td>
                                      </tr>
                                    </table>
                                    </form>
                                    <table class="idt_tle_mg" cellspacing="0" cellpadding="0" width="100%">
                                    <tr onclick="javascript:OnShow(tdForm,imgForm6);">
                                        <td class="idt_tle_i">
                                            <img id="imgForm6" src="/tdm/index/Themes/com/idt_tle_o.gif"></td>
                                        <td class="idt_tle_f1">
                                           相关文档</td>
                                    </tr>
                                </table>
                               </div>
                              </td>
                        </tr>
                    </table>
                </div> 
            </td>
        </tr>
    </table>
    
</body>
</html>
